ALESTE 520EX PROGRAMMING MANUAL (ENGLISH)

                           INTRODUCTION


     Computer go to AMSTRAD mode when "Shift" is pressed while reset. You
will se the BASIC's screen after.
     MSX DOS the screen could have 4 modes all of them have 25 lines by 40
or 80 characters. First two modes present at AMSTRAD mode.

              mode 0 - 640*200 pixels, no colors;
              mode 1 - 320*200 pixels, 4 colors;
              mode 2 - 640*200 pixels, 4 colors;
              mode 3 - 320*200 pixels, 16 colors.

     And palette for 64 colors could be used as well.


                         1.MAPPER

     Whole address space of Aleste 2MB paged by 16KB pages. The address space
of CPU 64KB paged too.
     There is 4 pages at CPU's space:
         Page 0  at 0000H - 3FFFH,
         Page 1  at 4000H - 7FFFH,
         Page 2  at 8000H - BFFFH,
         Page 3  at C000H - FFFFH.
    The mapper has 4 registers, each of them control one page of CPU memory.
(reg 0 - page 0, reg 1 - page 1 and etc).
     When you write the number of Aleste's page to any mapper's register you
switch this page at the CPU's page.
     Example: write 2 to register 1, switch on at 4000H - 7FFFH the 2 page
of Aleste's memory.
     You can also read the mapper.
     The mapper connected as PIO at address:
        register 0 - 7CXXH,
        register 1 - 7DXXH,
        register 2 - 7EXXH,
        register 3 - 7FXXH (XX - any value).
     MAPPER's (D6, D7) should be all the time 1.
     For MSX DOS works next configuration of memory:

     Pages  0  -  3 are screens             FFFFH +------------+
                                                  | Page     7 |
                                            C000H +------------|
     Pages  4  -  7 are pages for system          | Page     6 |
                                            8000H +------------|
                                                  | Page     5 |
                                            4000H +------------|
     Pages  8  -  9 are special                   | Page     4 |
There is MSX BIOS and MSX DISK BIOS         0000H +------------+
(page 8 BIOS, page 9 BDOS).

     Another pages could be used by applications for example PowerEdit uses
it as RamDisk and tex buffers.


                          3.SCREEN.

                    3.1 CRT.

     ALESTE 520EX  used MC6845

                   3.2 Palette.

     Aleste has palette (Color lockup table) it control which color really
have any from 16 input colors.  There is 64 output colors are possible.
      6 bits of palette coded as:
        D5, D4  RED,
        D3, D2  GREEN,
        D1, D0  BLUE
     For example for making the purple for color 4 we need to write at 4
address of palette the value 22H (100010).

                   3.3 Screen mode 0 and 1.

     Mode 0  has 640x200 pixels and no colors used 16KB of memory. The main
mode for text console emulation(25 x 80 chars).
     Mode 1  has 4 colors per pixel,  but 320x200 pixels (for text console
25 x 40 characters), needs same 16KB.
     Each byte has info about 4 pixels:
                            D7, D3 - first pixel color;
                            D6, D2 - second pixel color;
                            D5, D1 - third pixel color;
                            D4, D0 - fourth pixel color.
Each line needs 320/4 = 80 bytes. Look at image:
  +--------------------------------- - - - - -----------------+
0 |A+    0|A+    1|A+    2|A+    3|           |A+   78|A+   79|
  +-------+-------+-------+-------+- - - - - -+-------+-------|
1 |A+ 2048|A+ 2049|A+ 2050|A+ 2051|           |A+ 2126|A+ 2127|
  +-------+-------+-------+-------+- - - - - -+-------+-------|
2 |A+ 4096|A+ 4097|A+ 4098|A+ 4099|           |A+ 4174|A+ 4175|
  +-------+-------+-------+-------+- - - - - -+-------+-------|
3 |A+ 6144|A+ 6145|A+ 6146|A+ 6147|           |A+ 6222|A+ 6223|
  +-------+-------+-------+-------+- - - - - -+-------+-------|
4 |A+ 8192|A+ 8193|A+ 8194|A+ 8195|           |A+ 8270|A+ 8271|
  +-------+-------+-------+-------+- - - - - -+-------+-------|
5 |A+10240|A+10241|A+10242|A+10243|           |A+10318|A+10319|
  +-------+-------+-------+-------+- - - - - -+-------+-------|
6 |A+12288|A+12289|A+12290|A+12291|           |A+12366|A+12367|
  +-------+-------+-------+-------+- - - - - -+-------+-------|
7 |A+14336|A+14337|A+14338|A+14339|           |A+14414|A+14415|
  +-------+-------+-------+-------+- - - - - -+-------+-------|
8 |A+   80|A+   81|A+   82|A+   83|           |A+  158|A+  159|
  +-------+-------+-------+-------+- - - - - -+-------+-------|
  .       .       .       .       .           .       .       .
  .       .       .       .       .           .       .       .
  +-------+-------+-------+-------+- - - - - -+-------+-------|
6 |A+  160|A+  161|A+  162|A+  163|           |A+  238|A+  239|
  +-------+-------+-------+-------+- - - - - -+-------+-------|
  .       .       .       .       .           .       .       .
  .       .       .       .       .           .       .       .
  +-------+-------+-------+-------+- - - - - -+-------+-------|
9 |A+15920|A+15921|A+15922|A+15923|           |A+15998|A+15999|
  +-----------------------------------------------------------+

                    3.4 Screen mode 2 and 3.

     Mode 2 same as mode 1 has 4 colors, same color coding, but with
620x200 resolution, each line here used 640/4 = 160 bytes.
     Mode 3 each pixel has 16 colors deep, for 320x200 pixels.
     Color coding is: D7,D3,D5,D1  first pixel, D6,D2,D4,D0 second pixel.
     Line size is 320/2=160 bytes. Screens needs 32KB memory. And look at
image how it addressed:
  +--------------------------------- - - - - -----------------+
0 |A+    0|A+    1|A+    2|A+    3|           |A+  158|A+  159|
  +-------+-------+-------+-------+- - - - - -+-------+-------|
1 |A+16384|A+16385|A+16386|A+16387|           |A+16462|A+16463|
  +-------+-------+-------+-------+- - - - - -+-------+-------|
2 |A+ 4096|A+ 4097|A+ 4098|A+ 4099|           |A+ 4174|A+ 4175|
  +-------+-------+-------+-------+- - - - - -+-------+-------|
3 |A+20480|A+20481|A+20482|A+20482|           |A+20638|A+20639|
  +-------+-------+-------+-------+- - - - - -+-------+-------|
4 |A+ 8192|A+ 8193|A+ 8194|A+ 8195|           |A+ 8270|A+ 8271|
  +-------+-------+-------+-------+- - - - - -+-------+-------|
5 |A+24576|A+24577|A+24578|A+24579|           |A+24734|A+24735|
  +-------+-------+-------+-------+- - - - - -+-------+-------|
6 |A+12288|A+12289|A+12290|A+12291|           |A+12366|A+12367|
  +-------+-------+-------+-------+- - - - - -+-------+-------|
7 |A+28672|A+28673|A+28674|A+28675|           |A+28830|A+28831|
  +-------+-------+-------+-------+- - - - - -+-------+-------|
8 |A+  160|A+  161|A+  162|A+  163|           |A+  318|A+  319|
  +-------+-------+-------+-------+- - - - - -+-------+-------|
  .       .       .       .       .           .       .       .
  .       .       .       .       .           .       .       .
  +-------+-------+-------+-------+- - - - - -+-------+-------|
6 |A+  320|A+  321|A+  322|A+  323|           |A+  478|A+  479|
  +-------+-------+-------+-------+- - - - - -+-------+-------|
  .       .       .       .       .           .       .       .
  .       .       .       .       .           .       .       .
  +-------+-------+-------+-------+- - - - - -+-------+-------|
9 |A+32224|A+32225|A+32226|A+32227|           |A+32382|A+32383|
  +-----------------------------------------------------------+
              A - start address of the screen.

The  AMSTRAD  mode has also 160 * 200 pixels with 16 colors each. Screen
size 16KB the color coded same as at mode 3.


                   4.Sound

     Used AY-3-8910


                   5.External devices

     Floppy Disc Drive, mouse, printer and joystic could be used
     FD drive is 3,5"  80 treks,  capacity 720 KB.
     Any printer with Centronics interface.
     Mouse PC compat. with RS232 interface.


        Short description ports of ALESTE 520EX

     ALESTE 520 EX has 64KB ROM. It is paged as RAM by 16KB pages.
The page 0  ROM  can be on at 0000-3FFF instead of RAM, but pages
1,3,7 could be on from C000 to FFFF:

                   +--------------+
                +--+-----------+ 7|
     FFFF    +--+-----------+ 3+--+
             |    ROM 1     +--+
     C000    +--------------|
             |     RAM      |
     8000    +--------------|
             |     RAM      |
     4000    +--------------|
             |    ROM 0     |
     0000    +--------------+

     Numbers of ROM pages connected to to C000 may be up to 256.
ROM page 0 - Amstrad BIOS,
ROM page 1 - Amstrad BASIC,
ROM page 7 - Disk BIOS,
ROM page 3 - MSX DOS boot loader.

                     Ports input-output.

     7FFFH - MULTIPORT (write only). Has 4 registers.
 #1
+-------------------------------+
| 0 | 0 | X | ? | ? | ? | ? | ? | - Color number
+-------------------------------+
              |   |   |   |   |
              |   +---+---+---+---- number of color
              |
              +-------------------- 0 - color, 1 - border
 #1
+-------------------------------+
| 0 | 1 | R | r | G | g | B | b | - Palette MSX.
+-------------------------------+

The brightness of channels RGB with 2 bits per channel.
Where is R,G,B - high bits r,g,b -lo bits of channels.
 #1
+-------------------------------+
| 0 | 1 | X | ? | ? | ? | ? | ? | - Palette AMSTRAD mode.
+-------------------------------+
              |   |   |   |   |
              +---+---+---+---+---- Color number

    Table of brightness of channels for color number.

    +--------------------+    +--------------------+
    | NUMBER |   |   |   |    | NUMBER |   |   |   |
    |  OF    | R | G | B |    |   OF   | R | G | B |
    | COLOR  |   |   |   |    | COLOR  |   |   |   |
    |--------+---+---+---|    |--------+---+---+---|
    |        |   |   |   |    |        |   |   |   |
    |   0    | 1 | 1 | 1 |    |   10   | 0 | 0 | 1 |
    |   1    | 1 | 1 | 1 |    |   11   | 0 | 2 | 1 |
    |   2    | 0 | 2 | 1 |    |   12   | 0 | 2 | 0 |
    |   3    | 2 | 2 | 1 |    |   13   | 0 | 2 | 2 |
    |   4    | 0 | 0 | 1 |    |   14   | 0 | 0 | 0 |
    |   5    | 2 | 0 | 1 |    |   15   | 0 | 0 | 2 |
    |   6    | 0 | 1 | 1 |    |   16   | 0 | 1 | 0 |
    |   7    | 2 | 1 | 1 |    |   17   | 0 | 1 | 2 |
    |   8    | 2 | 0 | 1 |    |   18   | 1 | 0 | 1 |
    |   9    | 2 | 2 | 1 |    |   19   | 1 | 2 | 1 |
    |   A    | 2 | 2 | 0 |    |   1A   | 1 | 2 | 0 |
    |   B    | 2 | 2 | 2 |    |   1B   | 1 | 2 | 2 |
    |   C    | 2 | 0 | 0 |    |   1C   | 1 | 0 | 0 |
    |   D    | 2 | 0 | 2 |    |   1D   | 1 | 0 | 2 |
    |   E    | 2 | 1 | 0 |    |   1E   | 1 | 1 | 0 |
    |   F    | 2 | 1 | 2 |    |   1F   | 1 | 1 | 2 |
    |        |   |   |   |    |        |   |   |   |
    +--------------------+    +--------------------+
 #2
+-------------------------------+
| 1 | 0 | X | X | ? | ? | ? | ? |
+-------------------------------+
                  |   |   |   |
                  |   |   +---+---- Screen mode
                  |   |
                  |   +------------ 0 - ROM,
                  |                 1 - RAM @ 0000H .. 3FFFH
                  +---------------- 0 - ROM,
                                    1 - RAM @ C000H .. FFFFH
 #3
+-------------------------------+
| 1 | 1 | X | X | X | 0 | ? | ? | - RAM configurations
+-------------------------------+   at AMSTRAD mode
                          |   |
           +---+---+---+--+---+---- Configuration number
           |   |   |   |
+------------------------+
|Containg|   |   |   |   |
|   of   | 0 | 1 | 2 | 3 |
|register|   |   |   |   |
|--------+---+---+---+---|
| c C000 | 3 | 7 | 7 | 7 |
|--------+---+---+---+---|
| c 8000 | 2 | 2 | 6 | 2 |
|--------+---+---+---+---|
| c 4000 | 1 | 1 | 5 | 3 |
|--------+---+---+---+---|
| c 0000 | 0 | 0 | 4 | 0 |
+------------------------+
 #3
+-------------------------------+
| 1 | 1 | ? | ? | ? | 1 | ? | ? |  --  Reg. number of page
+-------------------------------+      RAM ( when  MAPMOD=0 ).
          |   |   |       |   |
          +---+---+-------+---+------  Page number, where is 0 -
                  |                    page number 4; 1 - 5 etc
                  |                    the page at the 4000
+------------------------------------+ ALESTE has 8 pages,
| ADRES  |      |      |      |      | it is 128K plus 64K
|   OF   | 0000 | 4000 | 8000 | C000 | of system pages 0-3.
|  PAGE  |      |      |      |      | Then,  AMSTRAD mode
|--------+------+------+------+------| has192K.
|  PAGE  |      |      |      |      |
|  RAM   |   0  |   ?  |   2  |   3  |
|        |      |      |      |      |
+------------------------------------+

Register #3 in the MSX mode converted to MAPPER.


     DFFFH - ROMPORT (write only)
     Page number of ROM for address C000
     1 -Basic 7 -Disc 3 -Boot

     FABFH - EXTEND PORT (write only)
Only BIOS could write to this port.

                 Video Controller M6845:
     BCFFH - register number (W)
     BDFFH - data (R/W)
+--------------------------------------------------------------+
| Number |  Containg       | read |                            |
|        |-----------------|  /   |       Function             |
|Register|mod. 0,1|mod. 2,3|write |                            |
|--------+--------+--------+------+----------------------------|
|    0   |    3F  |    6B  | -/W  | Full width (clocks)        |
|    1   |    28  |    50  | -/W  | Visible width (chars)      |
|    2   |    2E  |    52  | -/W  | HSYNC location             |
|    3   |    8E  |    8E  | -/W  | HSYNC length               |
|    4   |    1F  |    1F  | -/W  | Whole height (lines)       |
|    5   |    06  |    06  | -/W  | Add height                 |
|    6   |    19  |    19  | -/W  | Visible height (lines)     |
|    7   |    1B  |    1B  | -/W  | VSYNC location             |
|    8   |    00  |    00  | -/W  | SYNC MODE                  |
|    9   |    07  |    07  | -/W  | Lines at char              |
|   10   |    00  |    00  | -/W  | Start of cursor (lines)    |
|   11   |    00  |    00  | -/W  | End of cursor (lines)      |
|   12   |    30  |    30  | R/W  | Start of picture low       |
|   13   |    00  |    00  | R/W  | Start of picture hi        |
|   14   |    00  |    00  | R/W  | Cursor loc low             |
|   15   |    00  |    00  | R/W  | Cursor loc hi              |
|   16   |    --  |    --  | R/-  | Light pen position         |
|   17   |    --  |    --  | R/-  | hight and low bytes        |
+--------------------------------------------------------------+

                ???????????? Port 8255:
     F4FFH - A (write) PA0-PA7 - data bus for AY 8910,
                                              MC146818,
                                              8253.
     F5FFH - B (read)      PB0 -     VSYNC (1)
                           PB1 -     DISCINT (1 - FDC end of
                                     operation)
                           PB6 -     BUSY (0 - printer ready)
     F6FFH - C (write) PC0-PC3 - number of KBD row
                           PC4 -     printer strobe  (1)
                           PC6 -     BC1 AY 8910
                           PC7 -     BDIR AY 8910
     F7FFH - control word.
If  D7 = 1, then mode of 8255 set:
    D0    - C (PC0-PC3): 1 - in, 0 - ?????
    D1    - B (PB0-PB7): 1 - in, 0 - ?????
    D2    - B          : 0 - mod.0,1 - mod.1
    D3    - C (PC4-PC7): 1 - in, 0 - out
    D4    - A (PA0-PA7): 1 - in, 0 - out
    D5,D6 - A          : 00 - mod 0
                         01 - mod 1
                         10 - mod 2
                         11 - mod 2
If  D7 = 1,  the bit set function for C:
            D0 - command:   1 - set bit, 0 - reset bit
            D1-D3 bit of C

     The  AY-3-8910  ( clock 1MHz ).
Use only WR_PSG, RD_PSG functions of BIOS when access to AY.
+--------------------------------------------------------------+
| Number |           Function                                  |
|register|                                                     |
|--------+-----------------------------------------------------|
|    0   | Freq A, lo (D0-D7)                                  |
|    1   | Freq A, hi (D0-D3)                                  |
|    2   | Freq B, lo (D0-D7)                                  |
|    3   | Freq B, hi (D0-D3)                                  |
|    4   | Freq C, lo (D0-D7)                                  |
|    5   | Freq C, hi (D0-D3)                                  |
|    6   | Noise frequency                                     |
|    7   | ??????:  D0 - sound A  (0 - On, 1 - Off)            |
|        |          D1 - sound B  (0 - On, 1 - Off)            |
|        |          D2 - sound C  (0 - On, 1 - Off)            |
|        |          D3 - noise A   (0 - On, 1 - Off)           |
|        |          D4 - noise B   (0 - On, 1 - Off)           |
|        |          D5 - noise C   (0 - On, 1 - Off)           |
|        |          D6 - Port A  (0 - read, 1 - write)         |
|        |          D7 - Port B  (0 - read, 1 - write)         |
|    8   | Volume A                                            |
|    9   | Volume B                                            |
|   10   | Volume C                                            |
|   11   | Envelope period, lo byte                            |
|   12   | Envelope period, hi byte                            |
|   13   | Envelope:                                           |
|        |                                                     |
|        |   D3 D2 D1 D0                                       |
|        |                \                                    |
|        |    0  0  -  -   \____________                       |
|        |                                                     |
|        |                 /|                                  |
|        |    0  1  -  -  / |___________                       |
|        |                                                     |
|        |                \ |\ |\ |\ |\                        |
|        |    1  0  0  0   \| \| \| \| \                       |
|        |                                                     |
|        |                \                                    |
|        |    1  0  0  1   \____________                       |
|        |                                                     |
|        |                \  /\  /\  /\                        |
|        |    1  0  1  0   \/  \/  \/  \                       |
|        |                   ___________                       |
|        |                \ |                                  |
|        |    1  0  1  1   \|                                  |
|        |                                                     |
|        |                 /| /| /| /| /|                      |
|        |    1  1  0  0  / |/ |/ |/ |/ |                      |
|        |                  ____________                       |
|        |                 /                                   |
|        |    1  1  0  1  /                                    |
|        |                                                     |
|        |                 /\  /\  /\  /                       |
|        |    1  1  1  0  /  \/  \/  \/                        |
|        |                                                     |
|        |                 /|                                  |
|        |    1  1  1  1  / |___________                       |
|        |                                                     |
|   14   | Port A (read) - keyboard                            |
|   15   | Port B (write) - printer data (Centronics)          |
+--------------------------------------------------------------+

                        RTC (MC146818).
Access to RTC only with BIOS - WR_CLOCK, RD_CLOCK methods.
+--------------------------------------------------------------+
|register|           Description                               |
| Number |                                                     |
|--------+-----------------------------------------------------|
|    0   | Seconds                                             |
|    1   | Seconds alarm                                       |
|    2   | Minutes                                             |
|    3   | Minutes alarm                                       |
|    4   | Hours                                               |
|    5   | Hours alarm                                         |
|    6   | Day of week                                         |
|    7   | Day                                                 |
|    8   | Month                                               |
|    9   | Year                                                |
|   10   | Register A                                          |
|   11   | Register B                                          |
|   12   | Register C                                          |
|   13   | Register D                                          |
| 14..63 | Free memory ( bios configuration here ).            |
+--------------------------------------------------------------+

Ragister A:
          D7    1 - now is updating (read only)
          D6-D4 crystall speed (010 - 32768 Hz)
          D3-D0 interrupt frequence SQW

Ragister B:
          D7    1- do not update
          D6    1- interrupt enable, period at reg A
          D5    1- interrupt enable, alarm
          D4    1- interrupt when update done
          D3    1- enable output to SQW
          D2    1- time and data - binary code
                0- time an date at bin-dec code
          D1    1- 24 hours mode
                0- 12 hours mode
          D0    1- auto go to summer's time

Ragister C: (read only)
          D7    1- interrupt on
          D6
          D5    1- alarm on
          D4


Register D: (read only)
          D7- reset to 0 when power was off,
              Set to 1 after first reading

        Floppy Disk controller (8272A).

     FA7EH - write D0- 0 -MOTOR OFF  1 -MOTOR ON
     FB7EH - read status
     FB7FH - read / write data

                      KEYBOARD LAYOUT.

+-------------------------------------------------------------+
| N   |                     DATA                              |
| lin.|  D7     D6     D5     D4     D3     D2     D1     D0  |
|-----+-------------------------------------------------------|
|  0  |  D.   ENTER    D3     D6     D9    DOWN  RIGNT    UP  |
|     |                                                       |
|  1  |  D0     D2     D1     D5     D8     D7    ALT    LEFT |
|     |                                                       |
|  2  |  CTRL   \     SHIFT   D4     ]    RETURN   [      BS  |
|     |                                                       |
|  3  |  .      /      :      ;      P      @      -      f=  |
|     |                                                       |
|  4  |  ,      M      K      L      I      O      9      0   |
|     |                                                       |
|  5  |SPASE    N      J      H      Y      U      7      8   |
|     |                                                       |
|  6  |  V      B      F      G      T      R      5      6   |
|     |                                                       |
|  7  |  X      C      D      S      W      E      3      4   |
|     |                                                       |
|  8  |  Z     CAPS    A     TAB     Q     ESC     2      1   |
|     |                                                       |
|  9  | DEL    R/L   J.F.1  J.F.2   J.R.   J.L.   J.D.   J.U. |
|     |                                                       |
| 10  | F1/6   F2/7   F3/8   F4/9   F5/10  HELP   INS     b   |
+-------------------------------------------------------------+

                                  Magic sound short description

When I/O memory  access  and  A5  and  A10  are  equal  0  then
MagicSound address space enabled.

+--------------------------------------------------------------+
| Adress |           Description                               |
|10 5 9 8|                                                     |
|--------+-----------------------------------------------------|
| 0 0 0 0| WR/RD 8237                                          |
|        |                                                     |
|        | TC produce NMI                                      |
|        | A3-0 select register                                |
|        |                                                     |
| 0 0 0 1| WR    8254                                          |
|        |                                                     |
|        | Timers do not work after reset, and start working   |
|        | After first write to MS MAPPER                      |
|        | A1-0 Select register inside ICs                     |
|        | A2 equal 0 select Timer 1 (channels 1,2,3)          |
|        | A3 equal 0 select Timer 2 (channel 4 and L/R)       |
|        | L/R used for DAC only                               |
|        |                                                     |
| 0 0 1 0| WR Volume                                           |
|        |                                                     |
|        | A1-0 select channel(1,2,3,4)                        |
|        | D5-0 is volume                                      |
|        |                                                     |
| 0 0 1 1| WR MAPPER                                           |
|        |                                                     |
|        | A1-0 select channel(1,2,3,4)                        |
|        | D4-0 is page num of ALESTE memory                   |
|        |                                                     |
+--------------------------------------------------------------+
